package com.ai.platform.core.tag;

import org.springframework.stereotype.Component;
import org.thymeleaf.dialect.AbstractProcessorDialect;
import org.thymeleaf.processor.IProcessor;
import org.thymeleaf.standard.StandardDialect;

import java.util.HashSet;
import java.util.Set;

/**
 * @Auther: yeyingsheng
 * @Date: 2018/5/27 08:38
 * @Description:
 */
@Component
public class PermissionDialect extends AbstractProcessorDialect {


    public PermissionDialect() {
        super("permission dialect", "permission", StandardDialect.PROCESSOR_PRECEDENCE);
    }

    @Override
    public Set<IProcessor> getProcessors(String dialectPrefix) {
        final Set<IProcessor> processors = new HashSet<>();
        processors.add(new PrincipalTagProcessor(dialectPrefix));
        processors.add(new PermissionTagProcessor(dialectPrefix));
        return processors;
    }
}
